import {Component} from 'react'

class Counter extends Component{
    constructor(props){
        super(props)
        this.state = {
            num:0
        }
        this.handClick = this.handClick.bind(this)
    }
    handClick(){
        this.setState({
            num:++this.state.num
        })
    }
    render(){
        const {title = "实在不会起名字"} = this.props
        return (
            <div className="counter">
                <h3>{title}--{this.state.num}</h3>
                <button onClick={this.handClick}>count++</button>
            </div>
        )
    }
}
export default Counter